package com.easytopit.demo.dao;

import org.apache.ibatis.annotations.Param;

public class OrderMapperSql {
	public String searchOrder(@Param("name")String name,@Param("num")String num,@Param("payStatus")String payStatus,@Param("createTime")String createTime,@Param("endTime")String endTime,@Param("cinema")String cinema){
		StringBuilder sql = new StringBuilder();
		sql.append("select * from user_order where user_name = #{name,jdbcType=VARCHAR}");
		if(num!=null && !num.isEmpty()){
			sql.append("and num = #{num,jdbcType=VARCHAR}");
		}
		if(payStatus!=null && !payStatus.isEmpty()){
			sql.append("and pay_status = #{payStatus,jdbcType=VARCHAR}");
		}
		if(createTime!=null && !createTime.isEmpty()){
			sql.append("and create_time = #{createTime,jdbcType=VARCHAR}");
		}
		if(endTime!=null && !endTime.isEmpty()){
			sql.append("and end_time = #{endTime,jdbcType=VARCHAR}");
		}
		if(cinema!=null && !cinema.isEmpty()){
			sql.append("and cinema = #{cinema,jdbcType=VARCHAR}");
		}
		return sql.toString();
	}
}